<template>
  <div style="background-color: #f7f7f7;">
    <myNavbar title="精英券"></myNavbar>
    <div class="cash-out">
      <div class="cash-main">
        <div class="cash-top">
          <text class="cash-top-text">转赠精英券</text>
        </div>
        <div class="cash-bottom">
          <div class="cash-center">
            <div class="cash-data" >
              <text class="cash-center-mark">对方账号</text>
              <input class="cash-center-input" v-model="username" name="input" type="digit" :maxlength="maxlength" @click="getInput"  placeholder="请输入对方账号" />
            </div>
            <div  style="background-color: #D3D3D3;height:2px;margin-right: 30px;margin-left: 30px"></div>
            <div class="cash-data">
              <text class="cash-center-mark">支付密码</text>
              <input class="cash-center-input" v-model="password" name="input" type="digit" :maxlength="maxlength" @click="getInput"  placeholder="请输入支付密码" />
            </div>
            <div  style="background-color: #D3D3D3;height:2px;margin-left: 30px;margin-right: 30px;"></div>
            <div class="cash-data">
              <text class="cash-center-mark">数量</text>
              <input class="cash-center-input" v-model="amount" name="input" type="digit" :maxlength="maxlength" @click="getInput"  placeholder="转赠张数" />
            </div>
            <div  style="background-color: #D3D3D3;height:2px;margin-left: 30px;margin-right: 30px;"></div>

          </div>

          <div class="cash-btn">
<!--            @click="paymentClick"-->
            <div class="cash-btn-button" type="primary" @click="pick">
              <text class="cash-btn-button-text">确认转赠</text>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import md5 from "js-md5";
const eeui = app.requireModule('eeui');
import myNavbar from "../../../components/myNavbar/myNavbar.vue";
import { fillCard,cardBill } from '../../../api/cardBill';
const pay = app.requireModule("eeui/pay");
const picker = weex.requireModule('picker')
import {submit,query} from '../../../api/payment';
export default {
  data(){
    return{
      username:'',
      password:'',
      amount1:'',
      paymentVo:[1,2,3],
      balance: 0,
      point: 0,
      amount: "",
      maxlength: 10,
      disabled: true,
      check:'',
      paymentType:'weixinAppPayPlugin',
    }
  },
  components: { myNavbar },
  created(){
  },
  methods:{
    pick() {
      picker.pick({
        title:"是否确定转赠"
      }, event => {
        if (event.result === 'success') {
          this.paymentClick()
        }
      })
    },

    getInput(e) {
      let amount = this.amount
      let maxlength = amount.indexOf('.') + 3 // 限制小数点后只能输入两位
      if (maxlength == 2) {
        maxlength = 10
      }
      // let disabled = util.isNull(amount)
    },
    wholeCashOut() {
      let amount = this.balance / 100
      this.disabled = false;
    },
    changeClick(data){
      this.paymentType = data
    },
    paymentClick(){
      var _this = this
      console.log("132132133333333333333")
      console.log(_this.amount)
      if(_this.amount<=0|| _this.amount == null ){
        eeui.toast('请输入充值金额')
        return;
      }

      let params = {}
      params.amount = this.amount
      params.username = this.username
      params.capitalPassword = md5 (this.password)
      params.cardType = 6
      console.log("111111111111111111111111112222222222222222222333333333333333333333")
      console.log(params)
      cardBill(params).then(res=>{
        console.info( res )
        if(res.type == 'success'){
          eeui.toast('转赠成功')
          eeui.closePage();
        }
      });
    },
    },
}
</script>

<style scoped>
.cash-btn {
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding-top: 30px;
  padding-bottom: 30px;
}
.cash-btn-button {
  border-radius: 15px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  width: 600px;
  padding-top: 20px;
  padding-bottom: 20px;
  background-color: #00b43c;
}
.cash-btn-button-text{
  color: white;
  font-size: 32px;
}

input{
  background:none;
  outline:none;
  border:0px;
}


.cash-main {
  margin: 30px;
  background-color: #f7f7f7;
  border-radius: 14px;
}

.cash-top {
  padding: 40px;
  background-color: #fff;
  border-radius: 14px;
}
.cash-top-text{
  font-size: 30px;
  color: #555;
}


.cash-center{
  padding-top: 10px;
  background-color: #fff;
  padding-bottom: 10px;
}

.cash-data {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-size: 55px;
  padding: 30px 0;
}

.cash-center-mark {
  width:160px;
  margin-left: 40px;
  margin-right: 40px;
  /*font-size: 42px;*/
  font-size: 32px;
}

.cash-center-input {
  background-color: #fff;
  flex: 1;
  min-height: 65px;
}



page {
  background-color: rgba(248, 248, 248, 0.8);
}



.submit_product_details_IntroductionTwo {
  font-size: 24px;
  line-height: 26px;
  color: rgba(231, 91, 83, 1);
}

.submit_payMethod {
  width: 690px;
  padding: 25px;
  box-sizing: border-box;
  margin-top: 30px;
  background-color: white;
  border-radius: 16px;
}

.submit_payMethod_Header_Title {
  font-size: 32px;
  font-weight: 400;
  color: rgba(26, 26, 30, 1);
}

.submit_payMethod_Content {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  margin-top: 50px;
}

.submit_payMethod_Content_Column {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.submit_payMethod_Content_Title {
  font-size: 28px;
  font-weight: 400;
  color: rgba(26, 26, 30, 1);
  display: block;
}
.submit_payMethod_Content_SubTitle_item{
  display:flex;
  flex-direction: row;
  margin: 10px 0 0 10px;
}
.submit_payMethod_Content_SubTitle_wrap{
  display: flex;
  flex-direction: row;
  align-items: center;
}
.submit_payMethod_Content_SubTitle {
  font-size: 24px;
  font-weight: 400;
  color: rgba(231, 91, 83, 1);
  line-height: 36px;
  display: block;
}

.submit_payMethod_Content_Title_wrap{
  display: flex;
  flex-direction: row;
  align-items: center;
}
.submit_payMethod_Content_Column_wrap{
  display: flex;
  flex-direction: row;
}

.submit_payMethod_Content_Column_image{
  margin-right: 10px;
  display: flex;
  flex-direction: row;
  width:48px;
  height:48px;
}
</style>


